<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by an Apache 2.0 License.
See the COPYING file for details.
-->
<head>
<title>Closure Unit Tests - goog.ui.ActivityMonitor</title>
<script src="../base.js"></script>
<script>
  goog.require('goog.dom');
  goog.require('goog.testing.jsunit');
  goog.require('goog.ui.ActivityMonitor');
</script>
</head>
<body>
<script>

  // Override goog.now in order to test idle timer.
  var testTime = 0;
  goog.now = function() {
    return testTime;
  };


  function testIdle() {
    var activityMonitor = new goog.ui.ActivityMonitor();
    assertEquals(activityMonitor.getLastEventTime(), 0);

    testTime = 1000;
    activityMonitor.resetTimer();
    assertEquals(activityMonitor.getLastEventTime(), 1000);
    assertEquals(activityMonitor.getIdleTime(), 0);

    testTime = 2000;
    assertEquals(activityMonitor.getLastEventTime(), 1000);
    assertEquals(activityMonitor.getIdleTime(), 1000);
  }
</script>
</body>
</html>
